/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package in.jquickfinder.extensionviewer;

import in.jquickfinder.extensiondomain.FileExtension;
import java.beans.IntrospectionException;
import java.util.List;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;

/**
 *
 * @author Administrator
 */
public class FileExtensionChildFactory extends ChildFactory<FileExtension> {

    @Override
    protected boolean createKeys(List<FileExtension> list) {
        setList(list);
        return true;
    }

    @Override
    protected Node createNodeForKey(FileExtension key) {
        FileExtensionNode node = null;
        try {
            node = new FileExtensionNode(key);
        } catch (IntrospectionException ex) {
            Exceptions.printStackTrace(ex);
        }
        return node;
    }

    private void setList(List<FileExtension> list) {
        FileExtension txtExtension = new FileExtension("txt", "Text Document");
        FileExtension pdfExtension = new FileExtension("pdf", "PDF Document");
        FileExtension docExtension = new FileExtension("doc", "Microsoft Word Document");
        FileExtension docxExtension = new FileExtension("docx", "Microsoft Word 2007 Document");
        FileExtension pptExtension = new FileExtension("ppt", "Microsoft Powerpoint Document");
        FileExtension pptxExtension = new FileExtension("pptx", "Microsoft Powerpoint 2007 Document");
        FileExtension xlsExtension = new FileExtension("xls", "Microsoft Excel Document");
        FileExtension xlsxExtension = new FileExtension("xlsx", "Microsoft Excel 2007 Document");
        FileExtension xmlExtension = new FileExtension("xml", "XML Document");
        FileExtension aviExtension = new FileExtension("avi", "AVI Video File");
        FileExtension mkvExtension = new FileExtension("mkv", "MKV Video File");
        FileExtension javaExtension = new FileExtension("java", "Java Source File");
        FileExtension classExtension = new FileExtension("class", "Class File");
        FileExtension mp3Extension = new FileExtension("mp3", "MP3 File");
        FileExtension mp4Extension = new FileExtension("mp4", "MP4 File");
        FileExtension torrentExtension = new FileExtension("torrent", "Torrent File");
        FileExtension jpgExtension = new FileExtension("jpg", "JPEG Image File");
        FileExtension gifExtension = new FileExtension("gif", "GIF Image File");
        FileExtension csExtension = new FileExtension("cs", "C# Source File");
        FileExtension pngExtension = new FileExtension("png", "PNG Image File");
        FileExtension exeExtension = new FileExtension("exe", "Executable File");
        FileExtension htmlExtension = new FileExtension("html", "HTML File");
        FileExtension dhtmlExtension = new FileExtension("dhtml", "DHTML File");
        FileExtension cppExtension = new FileExtension("cpp", "C++ Source File");
        FileExtension cExtension = new FileExtension("c", "C Source File");
        FileExtension jarExtension = new FileExtension("jar", "JAR File");
        FileExtension zipExtension = new FileExtension("zip", "Zip File");
        FileExtension rarExtension = new FileExtension("rar", "RAR File");
        FileExtension sqlExtension = new FileExtension("sql", "SQL File");
        FileExtension datExtension = new FileExtension("dat", "Data File");
        FileExtension logExtension = new FileExtension("log", "Log File");
        list.add(txtExtension);
        list.add(pdfExtension);
        list.add(docExtension);
        list.add(docxExtension);
        list.add(pptExtension);
        list.add(pptxExtension);
        list.add(xlsExtension);
        list.add(xlsxExtension);
        list.add(xmlExtension);
        list.add(aviExtension);
        list.add(mkvExtension);
        list.add(javaExtension);
        list.add(classExtension);
        list.add(mp3Extension);
        list.add(mp4Extension);
        list.add(torrentExtension);
        list.add(jpgExtension);
        list.add(gifExtension);
        list.add(csExtension);
        list.add(pngExtension);
        list.add(exeExtension);
        list.add(htmlExtension);
        list.add(dhtmlExtension);
        list.add(cppExtension);
        list.add(cExtension);
        list.add(jarExtension);
        list.add(zipExtension);
        list.add(rarExtension);
        list.add(sqlExtension);
        list.add(datExtension);
        list.add(logExtension);
    }
}
